const store = require("./store")
store.subscribe(() => {
  console.log(store.getState())
})

const onChangeName = (name) => {
  return {
    type: "changeNameAction",
    name
  }
}

// 一定要通过派发action去修改
store.dispatch(onChangeName("kobe"))
store.dispatch(onChangeName("James"))

const onChangAge = (age) => ({ type: "changeAgeAction", age })
store.dispatch(onChangAge(-1))
store.dispatch(onChangAge(100))
